<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>壁纸APP - 精选专题</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        :root {
            --primary-color: #007AFF;
            --bg-color: #f5f5f5;
            --text-color: #333;
            --card-bg: #fff;
            --border-color: #f5f5f5;
            --secondary-text: #999;
            --shadow-color: rgba(0,0,0,0.1);
            --highlight-color: #f0f7ff;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            background-color: var(--bg-color);
            color: var(--text-color);
            min-height: 100vh;
            transition: all 0.3s ease;
        }
        
        body.dark-theme {
            --primary-color: #3a9bff;
            --bg-color: #121212;
            --text-color: #f5f5f5;
            --card-bg: #1e1e1e;
            --border-color: #2c2c2c;
            --secondary-text: #aaa;
            --shadow-color: rgba(0,0,0,0.3);
            --highlight-color: #1a2c42;
        }

        /* 顶部标题栏 */
        .header {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 44px;
            background: var(--card-bg);
            padding: 8px 16px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            box-shadow: 0 1px 3px var(--shadow-color);
            z-index: 100;
        }

        .header-title {
            font-size: 18px;
            font-weight: 500;
        }

        .back-button {
            display: flex;
            align-items: center;
            color: var(--primary-color);
            text-decoration: none;
            font-size: 14px;
        }

        .back-button i {
            margin-right: 4px;
        }

        /* 筛选栏 */
        .filter-bar {
            position: sticky;
            top: 44px;
            background: var(--card-bg);
            padding: 12px 16px;
            display: flex;
            overflow-x: auto;
            gap: 10px;
            box-shadow: 0 1px 3px var(--shadow-color);
            z-index: 90;
            scrollbar-width: none;
        }

        .filter-bar::-webkit-scrollbar {
            display: none;
        }

        .filter-item {
            padding: 6px 12px;
            background: var(--bg-color);
            border-radius: 16px;
            font-size: 14px;
            white-space: nowrap;
            color: var(--text-color);
            border: none;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .filter-item.active {
            background: var(--primary-color);
            color: white;
        }

        /* 主内容区 */
        .main-content {
            margin-top: 44px;
            padding: 16px;
            padding-bottom: 60px; /* 为底部导航留出空间 */
        }

        /* 专题网格 */
        .featured-grid {
            display: grid;
            grid-template-columns: repeat(1, 1fr);
            gap: 16px;
            margin-top: 16px;
        }

        @media (min-width: 768px) {
            .featured-grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        @media (min-width: 1024px) {
            .featured-grid {
                grid-template-columns: repeat(3, 1fr);
            }
        }

        .featured-item {
            position: relative;
            border-radius: 16px;
            overflow: hidden;
            background: var(--card-bg);
            box-shadow: 0 2px 8px var(--shadow-color);
            transition: all 0.3s ease;
            cursor: pointer;
        }

        .featured-item:hover {
            transform: translateY(-3px);
            box-shadow: 0 4px 12px var(--shadow-color);
        }

        .featured-image {
            width: 100%;
            aspect-ratio: 16/9;
            position: relative;
            overflow: hidden;
        }

        .featured-image img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform 0.5s ease;
        }

        .featured-item:hover .featured-image img {
            transform: scale(1.05);
        }

        .featured-tag {
            position: absolute;
            top: 12px;
            right: 12px;
            background: rgba(0,0,0,0.5);
            backdrop-filter: blur(5px);
            padding: 4px 10px;
            border-radius: 12px;
            font-size: 12px;
            color: white;
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .featured-info {
            padding: 16px;
        }

        .featured-name {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 8px;
            color: var(--text-color);
        }

        .featured-desc {
            font-size: 14px;
            color: var(--secondary-text);
            margin-bottom: 12px;
        }

        .featured-stats {
            display: flex;
            justify-content: space-between;
            font-size: 12px;
            color: var(--secondary-text);
        }

        .featured-stat {
            display: flex;
            align-items: center;
            gap: 4px;
        }

        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 49px;
            background: var(--card-bg);
            display: flex;
            justify-content: space-around;
            align-items: center;
            box-shadow: 0 -1px 3px var(--shadow-color);
            z-index: 100;
        }

        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: var(--secondary-text);
            font-size: 12px;
            text-decoration: none;
        }

        .nav-item.active {
            color: var(--primary-color);
        }

        /* 加载更多按钮 */
        .load-more {
            display: block;
            width: 100%;
            padding: 12px;
            margin-top: 20px;
            background: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            color: var(--primary-color);
            font-size: 14px;
            text-align: center;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .load-more:hover {
            background: var(--highlight-color);
        }
    </style>
</head>
<body>
    <!-- 顶部标题栏 -->
    <div class="header">
        <a href="index.html" class="back-button">
            <i class="fas fa-chevron-left"></i> 返回
        </a>
        <div class="header-title">精选专题</div>
        <div style="width: 24px;"></div> <!-- 占位元素，保持标题居中 -->
    </div>

    <!-- 筛选栏 -->
    <div class="filter-bar">
        <button class="filter-item active">全部</button>
        <button class="filter-item">热门</button>
        <button class="filter-item">最新</button>
        <button class="filter-item">风景</button>
        <button class="filter-item">城市</button>
        <button class="filter-item">星空</button>
        <button class="filter-item">艺术</button>
        <button class="filter-item">花卉</button>
        <button class="filter-item">游戏</button>
    </div>

    <!-- 主内容区 -->
    <div class="main-content">
        <div class="featured-grid" id="featured-grid">
            <!-- 专题项将由JavaScript动态加载 -->
        </div>

        <!-- 加载更多按钮 -->
        <button class="load-more" id="load-more">加载更多</button>
    </div>

    <!-- 底部导航 -->
    <div class="bottom-nav">
        <a href="index.html" class="nav-item">
            <i class="fas fa-home"></i>
            <span>首页</span>
        </a>
        <a href="category.html" class="nav-item">
            <i class="fas fa-th-large"></i>
            <span>分类</span>
        </a>
        <a href="my.html" class="nav-item">
            <i class="fas fa-user"></i>
            <span>我的</span>
        </a>
    </div>

    <script>
        // 专题数据 - 模拟数据
        const featuredData = [
            {
                id: 1,
                name: "夏日清凉壁纸",
                description: "精选20张清爽夏日壁纸",
                image: "https://picsum.photos/600/400?random=10",
                tag: "热门",
                icon: "fire",
                count: 20,
                views: 2345,
                likes: 432
            },
            {
                id: 2,
                name: "梦幻星空系列",
                description: "15张唯美星空壁纸",
                image: "https://picsum.photos/600/400?random=11",
                tag: "精选",
                icon: "star",
                count: 15,
                views: 1876,
                likes: 356
            },
            {
                id: 3,
                name: "城市夜景集",
                description: "18张城市夜景壁纸",
                image: "https://picsum.photos/600/400?random=12",
                tag: "最新",
                icon: "clock",
                count: 18,
                views: 1245,
                likes: 289
            },
            {
                id: 4,
                name: "自然风光精选",
                description: "25张自然风光壁纸",
                image: "https://picsum.photos/600/400?random=13",
                tag: "推荐",
                icon: "heart",
                count: 25,
                views: 2789,
                likes: 521
            },
            {
                id: 5,
                name: "极简主义壁纸",
                description: "12张简约风格壁纸",
                image: "https://picsum.photos/600/400?random=14",
                tag: "热门",
                icon: "fire",
                count: 12,
                views: 1543,
                likes: 312
            },
            {
                id: 6,
                name: "花卉植物集",
                description: "16张唯美花卉壁纸",
                image: "https://picsum.photos/600/400?random=15",
                tag: "精选",
                icon: "star",
                count: 16,
                views: 1876,
                likes: 345
            },
            {
                id: 7,
                name: "游戏主题壁纸",
                description: "22张热门游戏壁纸",
                image: "https://picsum.photos/600/400?random=16",
                tag: "最新",
                icon: "clock",
                count: 22,
                views: 2156,
                likes: 467
            },
            {
                id: 8,
                name: "动漫角色系列",
                description: "18张动漫人物壁纸",
                image: "https://picsum.photos/600/400?random=17",
                tag: "推荐",
                icon: "heart",
                count: 18,
                views: 2345,
                likes: 512
            }
        ];

        // 当前页码和每页显示数量
        let currentPage = 1;
        const itemsPerPage = 4;
        let filteredData = [...featuredData];

        // 初始加载专题
        loadFeaturedItems();

        // 加载专题函数
        function loadFeaturedItems() {
            const featuredGrid = document.getElementById('featured-grid');
            const startIndex = (currentPage - 1) * itemsPerPage;
            const endIndex = startIndex + itemsPerPage;
            const currentItems = filteredData.slice(startIndex, endIndex);

            // 如果是第一页，清空网格
            if (currentPage === 1) {
                featuredGrid.innerHTML = '';
            }

            // 添加专题项
            currentItems.forEach(item => {
                const featuredItem = document.createElement('div');
                featuredItem.className = 'featured-item';
                featuredItem.innerHTML = `
                    <div class="featured-image">
                        <img src="${item.image}" alt="${item.name}">
                        <div class="featured-tag">
                            <i class="fas fa-${item.icon}"></i>
                            ${item.tag}
                        </div>
                    </div>
                    <div class="featured-info">
                        <div class="featured-name">${item.name}</div>
                        <div class="featured-desc">${item.description}</div>
                        <div class="featured-stats">
                            <div class="featured-stat">
                                <i class="fas fa-image"></i>
                                ${item.count}张壁纸
                            </div>
                            <div class="featured-stat">
                                <i class="fas fa-eye"></i>
                                ${item.views}
                            </div>
                            <div class="featured-stat">
                                <i class="fas fa-heart"></i>
                                ${item.likes}
                            </div>
                        </div>
                    </div>
                `;
                featuredGrid.appendChild(featuredItem);
            });

            // 更新加载更多按钮状态
            const loadMoreButton = document.getElementById('load-more');
            if (endIndex >= filteredData.length) {
                loadMoreButton.style.display = 'none';
            } else {
                loadMoreButton.style.display = 'block';
            }
        }

        // 加载更多按钮点击事件
        document.getElementById('load-more').addEventListener('click', () => {
            currentPage++;
            loadFeaturedItems();
        });

        // 筛选按钮点击事件
        const filterButtons = document.querySelectorAll('.filter-item');
        filterButtons.forEach(button => {
            button.addEventListener('click', () => {
                // 更新按钮状态
                filterButtons.forEach(btn => btn.classList.remove('active'));
                button.classList.add('active');

                // 筛选数据
                const filterType = button.textContent;
                if (filterType === '全部') {
                    filteredData = [...featuredData];
                } else {
                    filteredData = featuredData.filter(item => {
                        // 根据标签或名称筛选
                        return item.tag === filterType || 
                               item.name.includes(filterType) || 
                               item.description.includes(filterType);
                    });
                }

                // 重置页码并重新加载
                currentPage = 1;
                loadFeaturedItems();
            });
        });

        // 暗黑模式切换（如果需要）
        function toggleDarkMode() {
            document.body.classList.toggle('dark-theme');
            // 可以保存用户偏好到localStorage
            const isDarkMode = document.body.classList.contains('dark-theme');
            localStorage.setItem('darkMode', isDarkMode);
        }

        // 检查用户之前的主题偏好
        const savedDarkMode = localStorage.getItem('darkMode');
        if (savedDarkMode === 'true') {
            document.body.classList.add('dark-theme');
        }
    </script>
</body>
</html>